/*
* @Author: Adolphus.Yao
* @Date:   2019-08-29 11:13:21
* @Last Modified by:   Adolphus.Yao
* @Last Modified time: 2019-08-29 11:29:56
*/
package main

import (
    "github.com/kataras/iris"
)

func main() {
    app := iris.New()
    app.OnErrorCode(iris.StatusNotFound, notFound)
    app.OnErrorCode(iris.StatusInternalServerError, internalServerError)
    //app.OnAnyErrorCode(handlers)
    app.Get("/", index)
    app.Run(iris.Addr(":8080"))
}

func notFound(ctx iris.Context) {
    ctx.Writef("Not Found Path: %s", ctx.Path())
}

func internalServerError(ctx iris.Context) {
    ctx.WriteString("Oups something want wrong, try again")
}

func index(ctx iris.Context) {
    ctx.WriteString("index")
}

func handlers(ctx iris.Context) {
    ctx.WriteString("AnyError")
}